<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;

function runTest() {
  description('Test that document.open() doesn\'t allow frames to be attached during frame detach.');
  window[0].document.open();
  window[0].document.appendChild(document.createElement('iframe'));
  window[0][0].addEventListener('unload', function() {
    window[0].document.documentElement.appendChild(document.createElement('iframe'));
    shouldBe('1', 'window[0].length');
    shouldBeUndefined('window[0][1]');
    finishJSTest();
  });
  window[0].location = 'data:text/plain,Hello world!';
}
</script>
</head>
<body onload="runTest()">
<iframe></iframe>
</body>
</html>
